import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '../index.vue'
import Housing from '../views/Housing'  //房源管理
import Live from '../views/live'  //直播管理
import Abulk from '../views/Abulk'  //团购管理
import Audit from '../views/Audit'  //审核管理
import order from '../views/order'  //订单管理
import information from '../views/information'  //咨询管理
import Agent from '../views/Agent'  //经纪人管理
import Login from '../views/Login'  //登录页面
import Detail from '../views/Detail'  //详情页


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: "/index"
  },
  {
    path: '/index',
    name: 'index',
    component: index,
    redirect: "/index/Housing",
    children: [
      //房源管理
      {
        path: '/index/Housing',
        name: 'Housing',
        component: Housing,
        meta:
        {
          author:["管理员","用户"],
          name:'房源管理'
        }
      },
      //直播管理
      {
        path: '/index/Live',
        name: 'Live',
        component: Live,
        meta:
        {
          author:["管理员"],
          name:'直播管理'
        }
      },
      //团购管理
      {
        path: '/index/Abulk',
        name: 'Abulk',
        component: Abulk,
        meta:
        {
          author:["用户","管理员"],
          name:'团购管理'
        }
      },
      //审核管理
      {
        path: '/index/Audit',
        name: 'Audit',
        component: Audit,
        meta:
        {
          author:["用户","管理员"],
          name:'审核管理'
        }
      },
      //订单管理
      {
        path: '/index/order',
        name: 'order',
        component: order,
        meta:
        {
          author:["管理员"],
          name:'订单管理'
        }
      },
      //咨询管理
      {
        path: '/index/information',
        name: 'information',
        component: information,
        meta:
        {
          author:["管理员"],
          name:'咨询管理'
        }
      },
      //经纪人管理
      {
        path: '/index/Agent',
        name: 'Agent',
        component: Agent,
        meta:
        {
          author:["用户","管理员"],
          name:'经纪人管理'
        }
      }
    ]
  },
   //登录
  {
    path: '/Login',
    name: 'Login',
    component: Login
  },
  //详情页
  {
    path: '/Detail/:id',
    name: 'Detail',
    component: Detail
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export{
  routes
}
export default router
